package com.esd.csair;

import java.io.IOException;
import java.io.Serializable;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.apache.log4j.Logger;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import com.esd.bjlhdx.Hejilei;
import com.esd.bjlhdx.Kechengguishulei;
import com.esd.bjlhdx.Kechengxingzhilei;
import com.esd.bjlhdx.SJkxx;
import com.esd.bjlhdx.SXkxx;
import com.esd.bjlhdx.TTBkxx;
import com.esd.bjlhdx.WAPkxx;
import com.esd.bjlhdx.Wtgorkczgcj;
import com.esd.bjlhdx.XnOption;
import com.esd.bjlhdx.Xqorxnorlncjcx;
import com.gargoylesoftware.htmlunit.AjaxController;
import com.gargoylesoftware.htmlunit.AlertHandler;
import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.ConfirmHandler;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController;
import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.StatusHandler;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.html.DomElement;
import com.gargoylesoftware.htmlunit.html.DomNode;
import com.gargoylesoftware.htmlunit.html.DomNodeList;
import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
import com.gargoylesoftware.htmlunit.html.HtmlButton;
import com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput;
import com.gargoylesoftware.htmlunit.html.HtmlDivision;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlInput;
import com.gargoylesoftware.htmlunit.html.HtmlListItem;
import com.gargoylesoftware.htmlunit.html.HtmlOption;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlPasswordInput;
import com.gargoylesoftware.htmlunit.html.HtmlSelect;
import com.gargoylesoftware.htmlunit.html.HtmlSpan;
import com.gargoylesoftware.htmlunit.html.HtmlTable;
import com.gargoylesoftware.htmlunit.html.HtmlTextArea;
import com.gargoylesoftware.htmlunit.html.HtmlUnorderedList;
import com.gargoylesoftware.htmlunit.javascript.JavaScriptErrorListener;

public class CsairImpl implements Serializable, Csair {
	private static Logger log = Logger.getLogger(CsairImpl.class);
	private static final long serialVersionUID = -7875415267036012443L;
	private CsairWebClient webClient = null;
	private SimpleConectionListener scl = null;
	private JavaScriptErrorListener jsel = null;
	private Integer timeoutmax = 50;
	private Long waittime = 1000L;
	private String alertMessage = null;
	private String URLflightQuery = null;

	public static void main(String[] args) {

	}

	public CsairImpl() {
		webClient = new CsairWebClient(BrowserVersion.CHROME);
		jsel = new JavaScriptErrorListenerEx();
		webClient.setJavaScriptErrorListener(jsel);
		webClient.setConfirmHandler(new ConfirmHandler() {
			public boolean handleConfirm(Page page, String message) {
				log.error("***************************************");
				log.error("handleConfirm:" + message);
				log.error("***************************************");
				return true;
			}
		});
		webClient.setAlertHandler(new AlertHandler() {
			public void handleAlert(Page page, String message) {
				alertMessage = message;
				log.info("***************************************");
				log.info("handleAlert:" + message);
				log.info("***************************************");
			}
		});
		webClient.setAjaxController(new AjaxController() {
			private static final long serialVersionUID = 7824466494627032976L;

			@Override
			public boolean processSynchron(HtmlPage page, WebRequest request, boolean async) {

				log.info("processSynchron===================" + request.getUrl());
				return super.processSynchron(page, request, async);
			}
		});
		// webClient.setHTMLParserListener(new HTMLParserListener() {
		//
		// @Override
		// public void warning(String arg0, URL arg1, String arg2, int arg3, int arg4,
		// String arg5) {
		//
		// log.error("warning:" + arg0 + "|" + arg1 + "|" + arg2 + "|" + arg3 + "|" +
		// arg4 + "|" + arg5);
		// }
		//
		// @Override
		// public void error(String arg0, URL arg1, String arg2, int arg3, int arg4,
		// String arg5) {
		//
		// log.error("error:" + arg0 + "|" + arg1 + "|" + arg2 + "|" + arg3 + "|" + arg4
		// + "|" + arg5);
		//
		// }
		// });
		webClient.setStatusHandler(new StatusHandler() {

			@Override
			public void statusMessageChanged(Page page, String message) {

				log.info(page.getUrl() + "[statusMessageChanged]" + message);
			}
		});
		webClient.getOptions().setTimeout(15 * 60 * 1000);// 设置“浏览器”的请求超时时间 15分钟
		webClient.getOptions().setMaxInMemory(768000);
		webClient.getOptions().setRedirectEnabled(true);
		webClient.getOptions().setThrowExceptionOnScriptError(false);// 当JS执行出错的时候是否抛出异常
		webClient.getOptions().setThrowExceptionOnFailingStatusCode(true);// 当HTTP的状态非200时是否抛出异常
		webClient.getOptions().setCssEnabled(true);// 是否启用CSS
		webClient.getOptions().setJavaScriptEnabled(true); // 很重要，启用JS
		webClient.setJavaScriptTimeout(100000);// 设置JS执行的超时时间
		webClient.waitForBackgroundJavaScript(10000);// 设置JS后台等待执行时间
		webClient.setAjaxController(new NicelyResynchronizingAjaxController());// 设置支持AJAX
		webClient.getOptions().setUseInsecureSSL(true);// SSL
		scl = new SimpleConectionListener(webClient);
		
	}

	@Override
	public void preIndex() {

	}

	@Override
	public void index() {

	}

	/**
	 * 判断登录状态
	 * 
	 * @return
	 */
	@SuppressWarnings("unchecked")
	@Override
	public Map<String, Object> checkLogin() {
		Map<String, Object> map = new HashMap<String, Object>();
		try {
			CsairPage checkLogin = webClient.getCsairJsonObjectPage(URLChecklogin);
			
			if (checkLogin.getJsonObject().isEmpty()) {
				return null;
			}
			map = checkLogin.getJsonObject();
			return map;
		} catch (FailingHttpStatusCodeException e) {
			log.error("FailingHttpStatusCodeException",e);
		} catch (MalformedURLException e) {
			log.error("MalformedURLException",e);
		} catch (IOException e) {
			log.error("IOException",e);
		}
		return null;
	}

	/**
	 *
	 * @author snailzhang
	 * @date 2017年8月8日
	 *
	 * @param returnValue
	 * @return
	 */
	private CsairReturnValue checkLoginReturnValue(CsairReturnValue returnValue) {
		Map<String, Object> map = checkLogin();
		if (map == null) {
			returnValue.setState(CS.FAIL);
			returnValue.setMessage("获取登录状态ao失败");
		}else {
			String success = String.valueOf(map.get("success"));
			log.info("登录成功状态:"+success);
			if (success.equals("true")) {
				returnValue.setState(CS.SUCCESS);
				returnValue.setMessage("登录成功");
				JSONObject jsonObject = (JSONObject) map.get("data");
				String loginType = String.valueOf(jsonObject.get("userType"));
				String userName = String.valueOf(jsonObject.get("userName"));
				returnValue.setLoginType(loginType);
				returnValue.setUserName(userName);
			} else {
				returnValue.setState(CS.FAIL);
				returnValue.setMessage("登录失败");
			}
		}
		
		return returnValue;
	}

	/**
	 * 用户监听加载页面的通用方法
	 *
	 * @author snailzhang
	 * @date 2017年7月25日
	 *
	 * @param page
	 * @param xpathExpr
	 */
	private CS loadPageHandler(CsairPage page, String xpathExpr) {
		log.info("====================loadPageHandler=========================");
		for (int i = 0; i <= timeoutmax; i++) {

			if (page.getHtmlPage() == null) {
				page.setPRE(CS.FAIL);
				log.info(page.getPRE());
				return CS.FAIL;
			}
//			log.info("------------------------------------------------------------------");
//			log.info(page.getHtmlPage().asXml());
//			log.info("------------------------------------------------------------------");
			Object obj = page.getHtmlPage().getFirstByXPath(xpathExpr);
			if (obj != null) {
				page.setPRE(CS.SUCCESS);
				log.info(page.getPRE());
				return CS.SUCCESS;
			}
			synchronized (page) {
				try {
					page.wait(waittime);
				} catch (InterruptedException e) {
					log.error("InterruptedException", e);
					Thread.currentThread().interrupt();
					page.setPRE(CS.FAIL);
					page.getHtmlPage().cleanUp();
					log.info(page.getPRE());
					return CS.FAIL;
				}
				page.setPRE(CS.LOADING);
				log.info(page.getPRE());
			}
		}
		page.setPRE(CS.TIMEOUT);
		page.getHtmlPage().cleanUp();
		log.info(page.getPRE());
		return CS.TIMEOUT;
	}

	/**
	 * 统一click 事件
	 *
	 * @author snailzhang
	 * @date 2017年8月8日
	 *
	 * @param element
	 * @return
	 */
	private HtmlPage clickHandler(DomElement element) {
		try {
			HtmlPage p = element.click();
			return p;
		} catch (IOException e) {
			log.error("IOException", e);
		}
		return null;
	}

	/**
	 * 预加载登录页
	 */
	@Override
	public void preLogin() {
		if (loginPage != null) {
			if ((CS.SUCCESS).equals(loginPage.getPRE())) {
				return;
			}
		}
		loginPage = webClient.getCsairHtmlPage(Csair.URLloginBJLHPage, "URLloginBJLHPage", true);
		loadPageHandler(loginPage, "//input[@id='userId']");

	}

	/**
	 * 登录
	 */
	@Override
	public CsairReturnValue login(String username, String password) {
		CsairReturnValue returnValue = new CsairReturnValue();
		CS cs = loadPageHandler(loginPage, "//input[@id='userId']");
		if (CS.SUCCESS != cs) {
			preLogin();
		}
		HtmlPage page = loginPage.getHtmlPage();
//		log.info("********************************"+page.asXml());
		if (loginPage.getPRE().equals(CS.SUCCESS)) {// 加载完成
			HtmlForm form = page.getFirstByXPath("//form[@id='memberLogin']");
			loginPage.setParent(form);
			HtmlInput userId = form.getFirstByXPath("//input[@id='userId']");
			userId.setValueAttribute(username);
			HtmlPasswordInput passWord = form.getFirstByXPath("//input[@id='passWord']");
			passWord.setValueAttribute(password);
			HtmlButton submit = (HtmlButton) form.getFirstByXPath("//button[@type='submit']");
			//log.info("********************************"+form.asXml());
			page = clickHandler(submit);
		}
		for (int i = 0; i < timeoutmax; i++) {
			if(scl.URLloginFunction != null){
				returnValue = checkLoginReturnValue(returnValue);
				return returnValue;
			}
			synchronized (page) {
				try {
					page.wait(800);
				} catch (InterruptedException e) {
					log.error("InterruptedException", e);
					Thread.currentThread().interrupt(); // Here!
				}
			}
			log.info("等待返回页面登录方法......");
		}
		returnValue = checkLoginReturnValue(returnValue);
		return returnValue;
	}


	
	public CsairWebClient getWebClient() {
		return webClient;
	}

	// private CsairPage indexPage = new CsairPage(); // 首页
	private CsairPage loginPage = new CsairPage(); // 登录

	
/*******************************************************************************************************************/
	private CsairPage loginBJLHPage = new CsairPage();// 北京联合大学无障碍登录页
	private CsairPage xskbcxPage = new CsairPage();// 北京联合大学无障碍学生课表页
	private CsairPage xscjcxPage = new CsairPage();// 北京联合大学无障碍学生成绩查询页
	private CsairPage xsjxpjPage = new CsairPage();// 北京联合大学无障碍教师质量评价页
	
	
	
	/**
	 * 北京联合大学无障碍登录预加载
	 */
	@Override
	public void preloginBJLH() {
		if (loginBJLHPage != null) {
			if ((CS.SUCCESS).equals(loginBJLHPage.getPRE())) {
				return;
			}
		}
		loginBJLHPage = webClient.getCsairHtmlPage(Csair.URLloginBJLHPage, "loginBJLHPage", true);
		loadPageHandler(loginBJLHPage, "//input[@id='txtUserName']");

	}
	
	/**
	 * 北京联合大学无障碍登录
	 * @param num
	 * @param psd
	 * @return
	 */
	public Map<String, Object> loginBJLH(String num, String psd) {
		scl.BJLHLoginSuccess = null;
		Map<String, Object> map = new HashMap<String, Object>();
		long time1 = System.currentTimeMillis();
		long time2 = 0;
		long time3 = 0;
		long time4 = 0;
		CS cs = loadPageHandler(loginBJLHPage, "//input[@id='txtUserName']");
		if (CS.SUCCESS != cs) {
			preLogin();
		}
		HtmlPage page = loginBJLHPage.getHtmlPage();
//		log.info("********************************"+page.asXml());
		if (loginBJLHPage.getPRE().equals(CS.SUCCESS)) {// 加载完成
			time2 = System.currentTimeMillis();
			HtmlForm div = page.getFirstByXPath("//div[@class='login_right']");
			loginBJLHPage.setParent(div);
			HtmlInput userId = div.getFirstByXPath("//input[@id='txtUserName']");
			userId.setValueAttribute(num);
			HtmlPasswordInput passWord = div.getFirstByXPath("//input[@id='Textbox1']");
			passWord.setValueAttribute(psd);
			HtmlInput submit = (HtmlInput) div.getFirstByXPath("//input[@id='Button1']");
			//log.info("********************************"+form.asXml());
			page = clickHandler(submit);
			time3 = System.currentTimeMillis();
		}
		for (int i = 0; i < timeoutmax; i++) {
			if(scl.BJLHLoginSuccess != null){
				time4 = System.currentTimeMillis();
				long jiazaiTime = time2-time1+(time4-time3);
				long chuliTime = time3-time2;
				long totleTime = time4-time1;
				map.put("time","总用时为："+totleTime/1000+"s,网站加载用时："+jiazaiTime/1000+"s,无障碍处理用时："+chuliTime/1000+"s");
				map.put("notice", "true");
				return map;
			}
			synchronized (page) {
				try {
					page.wait(800);
				} catch (InterruptedException e) {
					log.error("InterruptedException", e);
					Thread.currentThread().interrupt(); // Here!
				}
			}
			log.info("等待返回页面登录方法......");
		}
		map.put("notice", "false");
		return map;
	}

	/**
	 * 加载学生课表查询页
	 */
	@Override
	public Map<String, Object> loadgerenkechengbiao(String num) {
		Map<String, Object> map = new HashMap<String ,Object>();
		long time1 = System.currentTimeMillis();
		String URLxskbcx = Csair.BJLHxsgrkbPage+"?xh="+num;
		xskbcxPage = webClient.getCsairHtmlPage(URLxskbcx, "xskbcxPage", false);
		HtmlPage page = xskbcxPage.getHtmlPage();
		for (int i = 0; i < timeoutmax; i++) {
			DomNodeList<HtmlElement> as = page.getBody().getElementsByTagName("a");
			if(as.size()!= 0) {
				long time2 = System.currentTimeMillis();
				HtmlAnchor a = (HtmlAnchor) as.get(0);
				if(a.asText().contains("here")) {
					clickHandler(a);
					long time3 = System.currentTimeMillis();
					for (int j = 0; j < timeoutmax; j++) {
						HtmlTable table1 = (HtmlTable) page.getElementById("Table1");
						if(table1!= null) {
							long time4 = System.currentTimeMillis();
							String name = page.getElementById("Label6").asText();
							String colleage = page.getElementById("Label7").asText();
							String major = page.getElementById("Label8").asText();
							String xzb = page.getElementById("Label9").asText();
							map.put("name", name);
							map.put("colleage", colleage);
							map.put("major", major);
							map.put("xzb", xzb);
							
							List<XnOption> xnOptionList = new ArrayList<XnOption>();
							HtmlSelect xndSelect = (HtmlSelect) page.getElementById("xnd");
							DomNodeList<HtmlElement> options = xndSelect.getElementsByTagName("option");
							for (int k = 0; k < options.size(); k++) {
								XnOption xnOption = new XnOption();
								HtmlElement option = options.get(k);
								String optionValue = option.getAttribute("value");
								String optionText = option.asText();
								xnOption.setOptionValue(optionValue);
								xnOption.setOptionText(optionText);
								xnOptionList.add(xnOption);
							}
							map.put("xnOptionList", xnOptionList);
							
							String table1Xml = table1.asXml();
							map.put("table1Xml", table1Xml);
							
							List<TTBkxx> ttbkxxList = new ArrayList<TTBkxx>();
							HtmlTable DBGridTable = (HtmlTable) page.getElementById("DBGrid");
							DomNodeList<HtmlElement> DBGridTableTrs = DBGridTable.getElementsByTagName("tr");
							for (int k = 1; k < DBGridTableTrs.size(); k++) {
								TTBkxx ttbkxx = new TTBkxx();
								HtmlElement DBGridTableTr = DBGridTableTrs.get(k);
								DomNodeList<HtmlElement> DBGridTableTrTds = DBGridTableTr.getElementsByTagName("td");
								if(DBGridTableTrTds.size() != 0) {
									ttbkxx.setBianhao(DBGridTableTrTds.get(0).asText());
									ttbkxx.setKechengmingcheng(DBGridTableTrTds.get(1).asText());
									ttbkxx.setYuansksdj(DBGridTableTrTds.get(2).asText());
									ttbkxx.setXiansksdj(DBGridTableTrTds.get(3).asText());
									ttbkxx.setShenqingshijian(DBGridTableTrTds.get(4).asText());
									ttbkxxList.add(ttbkxx);
								}
							}
							map.put("ttbkxxList", ttbkxxList);
							
							List<SJkxx> sjkxxList = new ArrayList<SJkxx>();
							HtmlTable DataGrid1Table = (HtmlTable) page.getElementById("DataGrid1");
							DomNodeList<HtmlElement> DataGrid1TableTrs = DataGrid1Table.getElementsByTagName("tr");
							for (int k = 1; k < DataGrid1TableTrs.size(); k++) {
								SJkxx sjkxx = new SJkxx();
								HtmlElement DataGrid1TableTr = DataGrid1TableTrs.get(k);
								DomNodeList<HtmlElement> DataGrid1TableTrTds = DataGrid1TableTr.getElementsByTagName("td");
								if(DataGrid1TableTrTds.size() != 0) {
									sjkxx.setKechengmingcheng(DataGrid1TableTrTds.get(0).asText());
									sjkxx.setJiaoshi(DataGrid1TableTrTds.get(1).asText());
									sjkxx.setXuefen(DataGrid1TableTrTds.get(2).asText());
									sjkxx.setQizhizhou(DataGrid1TableTrTds.get(3).asText());
									sjkxx.setShangkeshijian(DataGrid1TableTrTds.get(4).asText());
									sjkxx.setShangkedidian(DataGrid1TableTrTds.get(5).asText());
									sjkxxList.add(sjkxx);
								}
							}
							map.put("sjkxxList", sjkxxList);
							
							List<SXkxx> sxkxxList = new ArrayList<SXkxx>();
							HtmlTable DBGridYxkcTable = (HtmlTable) page.getElementById("DBGridYxkc");
							DomNodeList<HtmlElement> DBGridYxkcTableTrs = DBGridYxkcTable.getElementsByTagName("tr");
							for (int k = 1; k < DBGridYxkcTableTrs.size(); k++) {
								SXkxx sxkxx = new SXkxx();
								HtmlElement DBGridYxkcTableTr = DBGridYxkcTableTrs.get(k);
								DomNodeList<HtmlElement> DBGridYxkcTableTrTds = DBGridYxkcTableTr.getElementsByTagName("td");
								if(DBGridYxkcTableTrTds.size()!= 0) {
									sxkxx.setXuenian(DBGridYxkcTableTrTds.get(0).asText());
									sxkxx.setXueqi(DBGridYxkcTableTrTds.get(1).asText());
									sxkxx.setKechengmingcheng(DBGridYxkcTableTrTds.get(2).asText());
									sxkxx.setShixishijian(DBGridYxkcTableTrTds.get(3).asText());
									sxkxx.setMokuaidaima(DBGridYxkcTableTrTds.get(4).asText());
									sxkxx.setXianxiumokuai(DBGridYxkcTableTrTds.get(5).asText());
									sxkxx.setShixibianhao(DBGridYxkcTableTrTds.get(6).asText());
									sxkxxList.add(sxkxx);
								}
							}
							map.put("sxkxxList", sxkxxList);
							
							List<WAPkxx> wapkxxList = new ArrayList<WAPkxx>();
							HtmlTable Datagrid2Table = (HtmlTable) page.getElementById("Datagrid2");
							DomNodeList<HtmlElement> Datagrid2TableTrs = Datagrid2Table.getElementsByTagName("tr");
							for (int k = 1; k < Datagrid2TableTrs.size(); k++) {
								WAPkxx wapkxx = new WAPkxx();
								HtmlElement Datagrid2TableTr = Datagrid2TableTrs.get(k);
								DomNodeList<HtmlElement> Datagrid2TableTrTds = Datagrid2TableTr.getElementsByTagName("td");
								if(Datagrid2TableTrTds.size()!= 0) {
									wapkxx.setXuenian(Datagrid2TableTrTds.get(0).asText());
									wapkxx.setXueqi(Datagrid2TableTrTds.get(1).asText());
									wapkxx.setKechengmingcheng(Datagrid2TableTrTds.get(2).asText());
									wapkxx.setJiaoshixingming(Datagrid2TableTrTds.get(3).asText());
									wapkxx.setXuefen(Datagrid2TableTrTds.get(4).asText());
									wapkxxList.add(wapkxx);
								}
							}
							map.put("wapkxxList", wapkxxList);
							long time5 = System.currentTimeMillis();
							long totleTime = time5 - time1;
							long jiazaiTime = time2 - time1 + (time4 - time3);
							long chuliTime = time3 - time2 + (time5 - time4);
							map.put("time","总用时为："+totleTime/1000+"s,网站加载用时："+jiazaiTime/1000+"s,无障碍处理用时："+chuliTime/1000+"s");
							map.put("notice", "true");
							return map;
						}
						synchronized (page) {
							try {
								page.wait(800);
							} catch (InterruptedException e) {
								// TODO Auto-generated catch block
								e.printStackTrace();
							}
							log.info("加载学生课表查询页........");
						}
					}
					
				}
			}
			
			synchronized (page) {
				try {
					page.wait(500);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				log.info("加载跳转页........");
			}	
		}
		map.put("notice", "false");
		return map;
	}

	/**
	 * 变更学年select学生课表查询加载
	 */
	@Override
	public Map<String, Object> xnselectloadgerenkechengbiao(String xnd) {
		scl.BJLHLoginSuccess = null;
		Map<String, Object> map = new  HashMap<String, Object>();
		long time1 = System.currentTimeMillis();
		HtmlPage page = xskbcxPage.getHtmlPage();
		HtmlSelect xndSelect = (HtmlSelect) page.getElementById("xnd");
		HtmlOption xndOption = xndSelect.getOptionByValue(xnd);
		xndOption.setSelected(true);
		long time2 = System.currentTimeMillis();
		for (int i = 0; i < timeoutmax; i++) {
			if(scl.BJLHLoginSuccess != null) {
				long time3 = System.currentTimeMillis();
				HtmlTable table1 = (HtmlTable) page.getElementById("table1");
				String table1Xml = table1.asXml();
				map.put("table1Xml", table1Xml);
				
				List<TTBkxx> ttbkxxList = new ArrayList<TTBkxx>();
				HtmlTable DBGridTable = (HtmlTable) page.getElementById("DBGrid");
				DomNodeList<HtmlElement> DBGridTableTrs = DBGridTable.getElementsByTagName("tr");
				for (int k = 1; k < DBGridTableTrs.size(); k++) {
					TTBkxx ttbkxx = new TTBkxx();
					HtmlElement DBGridTableTr = DBGridTableTrs.get(k);
					DomNodeList<HtmlElement> DBGridTableTrTds = DBGridTableTr.getElementsByTagName("td");
					if(DBGridTableTrTds.size() != 0) {
						ttbkxx.setBianhao(DBGridTableTrTds.get(0).asText());
						ttbkxx.setKechengmingcheng(DBGridTableTrTds.get(1).asText());
						ttbkxx.setYuansksdj(DBGridTableTrTds.get(2).asText());
						ttbkxx.setXiansksdj(DBGridTableTrTds.get(3).asText());
						ttbkxx.setShenqingshijian(DBGridTableTrTds.get(4).asText());
						ttbkxxList.add(ttbkxx);
					}
				}
				map.put("ttbkxxList", ttbkxxList);
				
				List<SJkxx> sjkxxList = new ArrayList<SJkxx>();
				HtmlTable DataGrid1Table = (HtmlTable) page.getElementById("DataGrid1");
				DomNodeList<HtmlElement> DataGrid1TableTrs = DataGrid1Table.getElementsByTagName("tr");
				for (int k = 1; k < DataGrid1TableTrs.size(); k++) {
					SJkxx sjkxx = new SJkxx();
					HtmlElement DataGrid1TableTr = DataGrid1TableTrs.get(k);
					DomNodeList<HtmlElement> DataGrid1TableTrTds = DataGrid1TableTr.getElementsByTagName("td");
					if(DataGrid1TableTrTds.size() != 0) {
						sjkxx.setKechengmingcheng(DataGrid1TableTrTds.get(0).asText());
						sjkxx.setJiaoshi(DataGrid1TableTrTds.get(1).asText());
						sjkxx.setXuefen(DataGrid1TableTrTds.get(2).asText());
						sjkxx.setQizhizhou(DataGrid1TableTrTds.get(3).asText());
						sjkxx.setShangkeshijian(DataGrid1TableTrTds.get(4).asText());
						sjkxx.setShangkedidian(DataGrid1TableTrTds.get(5).asText());
						sjkxxList.add(sjkxx);
					}
				}
				map.put("sjkxxList", sjkxxList);
				
				List<SXkxx> sxkxxList = new ArrayList<SXkxx>();
				HtmlTable DBGridYxkcTable = (HtmlTable) page.getElementById("DBGridYxkc");
				DomNodeList<HtmlElement> DBGridYxkcTableTrs = DBGridYxkcTable.getElementsByTagName("tr");
				for (int k = 1; k < DBGridYxkcTableTrs.size(); k++) {
					SXkxx sxkxx = new SXkxx();
					HtmlElement DBGridYxkcTableTr = DBGridYxkcTableTrs.get(k);
					DomNodeList<HtmlElement> DBGridYxkcTableTrTds = DBGridYxkcTableTr.getElementsByTagName("td");
					if(DBGridYxkcTableTrTds.size()!= 0) {
						sxkxx.setXuenian(DBGridYxkcTableTrTds.get(0).asText());
						sxkxx.setXueqi(DBGridYxkcTableTrTds.get(1).asText());
						sxkxx.setKechengmingcheng(DBGridYxkcTableTrTds.get(2).asText());
						sxkxx.setShixishijian(DBGridYxkcTableTrTds.get(3).asText());
						sxkxx.setMokuaidaima(DBGridYxkcTableTrTds.get(4).asText());
						sxkxx.setXianxiumokuai(DBGridYxkcTableTrTds.get(5).asText());
						sxkxx.setShixibianhao(DBGridYxkcTableTrTds.get(6).asText());
						sxkxxList.add(sxkxx);
					}
				}
				map.put("sxkxxList", sxkxxList);
				
				List<WAPkxx> wapkxxList = new ArrayList<WAPkxx>();
				HtmlTable Datagrid2Table = (HtmlTable) page.getElementById("Datagrid2");
				DomNodeList<HtmlElement> Datagrid2TableTrs = Datagrid2Table.getElementsByTagName("tr");
				for (int k = 1; k < Datagrid2TableTrs.size(); k++) {
					WAPkxx wapkxx = new WAPkxx();
					HtmlElement Datagrid2TableTr = Datagrid2TableTrs.get(k);
					DomNodeList<HtmlElement> Datagrid2TableTrTds = Datagrid2TableTr.getElementsByTagName("td");
					if(Datagrid2TableTrTds.size()!= 0) {
						wapkxx.setXuenian(Datagrid2TableTrTds.get(0).asText());
						wapkxx.setXueqi(Datagrid2TableTrTds.get(1).asText());
						wapkxx.setKechengmingcheng(Datagrid2TableTrTds.get(2).asText());
						wapkxx.setJiaoshixingming(Datagrid2TableTrTds.get(3).asText());
						wapkxx.setXuefen(Datagrid2TableTrTds.get(4).asText());
						wapkxxList.add(wapkxx);
					}
				}
				map.put("wapkxxList", wapkxxList);
				long time4 = System.currentTimeMillis();
				long totleTime = time4 - time1;
				long jiazaiTime = time3 - time2;
				long chuliTime = time2 - time1 + (time4 - time3);
				map.put("time","总用时为："+totleTime/1000+"s,网站加载用时："+jiazaiTime/1000+"s,无障碍处理用时："+chuliTime/1000+"s");
				map.put("notice", "true");
				return map;
			}
			synchronized (page) {
				try {
					page.wait(500);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				log.info("加载变更文件......");
			}
		}
		map.put("notice", "false");
		return map;
	}

	/**
	 * 变更学期select学生课表查询加载
	 */
	@Override
	public Map<String, Object> xqselectloadgerenkechengbiao(String xqd) {
		scl.BJLHLoginSuccess = null;
		Map<String, Object> map = new  HashMap<String, Object>();
		long time1 = System.currentTimeMillis();
		HtmlPage page = xskbcxPage.getHtmlPage();
		HtmlSelect xqdSelect = (HtmlSelect) page.getElementById("xqd");
		HtmlOption xqdOption = xqdSelect.getOptionByValue(xqd);
		xqdOption.setSelected(true);
		long time2 = System.currentTimeMillis();
		for (int i = 0; i < timeoutmax; i++) {
			if(scl.BJLHLoginSuccess != null) {
				long time3 = System.currentTimeMillis();
				HtmlTable table1 = (HtmlTable) page.getElementById("table1");
				String table1Xml = table1.asXml();
				map.put("table1Xml", table1Xml);
				
				List<TTBkxx> ttbkxxList = new ArrayList<TTBkxx>();
				HtmlTable DBGridTable = (HtmlTable) page.getElementById("DBGrid");
				DomNodeList<HtmlElement> DBGridTableTrs = DBGridTable.getElementsByTagName("tr");
				for (int k = 1; k < DBGridTableTrs.size(); k++) {
					TTBkxx ttbkxx = new TTBkxx();
					HtmlElement DBGridTableTr = DBGridTableTrs.get(k);
					DomNodeList<HtmlElement> DBGridTableTrTds = DBGridTableTr.getElementsByTagName("td");
					if(DBGridTableTrTds.size() != 0) {
						ttbkxx.setBianhao(DBGridTableTrTds.get(0).asText());
						ttbkxx.setKechengmingcheng(DBGridTableTrTds.get(1).asText());
						ttbkxx.setYuansksdj(DBGridTableTrTds.get(2).asText());
						ttbkxx.setXiansksdj(DBGridTableTrTds.get(3).asText());
						ttbkxx.setShenqingshijian(DBGridTableTrTds.get(4).asText());
						ttbkxxList.add(ttbkxx);
					}
				}
				map.put("ttbkxxList", ttbkxxList);
				
				List<SJkxx> sjkxxList = new ArrayList<SJkxx>();
				HtmlTable DataGrid1Table = (HtmlTable) page.getElementById("DataGrid1");
				DomNodeList<HtmlElement> DataGrid1TableTrs = DataGrid1Table.getElementsByTagName("tr");
				for (int k = 1; k < DataGrid1TableTrs.size(); k++) {
					SJkxx sjkxx = new SJkxx();
					HtmlElement DataGrid1TableTr = DataGrid1TableTrs.get(k);
					DomNodeList<HtmlElement> DataGrid1TableTrTds = DataGrid1TableTr.getElementsByTagName("td");
					if(DataGrid1TableTrTds.size() != 0) {
						sjkxx.setKechengmingcheng(DataGrid1TableTrTds.get(0).asText());
						sjkxx.setJiaoshi(DataGrid1TableTrTds.get(1).asText());
						sjkxx.setXuefen(DataGrid1TableTrTds.get(2).asText());
						sjkxx.setQizhizhou(DataGrid1TableTrTds.get(3).asText());
						sjkxx.setShangkeshijian(DataGrid1TableTrTds.get(4).asText());
						sjkxx.setShangkedidian(DataGrid1TableTrTds.get(5).asText());
						sjkxxList.add(sjkxx);
					}
				}
				map.put("sjkxxList", sjkxxList);
				
				List<SXkxx> sxkxxList = new ArrayList<SXkxx>();
				HtmlTable DBGridYxkcTable = (HtmlTable) page.getElementById("DBGridYxkc");
				DomNodeList<HtmlElement> DBGridYxkcTableTrs = DBGridYxkcTable.getElementsByTagName("tr");
				for (int k = 1; k < DBGridYxkcTableTrs.size(); k++) {
					SXkxx sxkxx = new SXkxx();
					HtmlElement DBGridYxkcTableTr = DBGridYxkcTableTrs.get(k);
					DomNodeList<HtmlElement> DBGridYxkcTableTrTds = DBGridYxkcTableTr.getElementsByTagName("td");
					if(DBGridYxkcTableTrTds.size()!= 0) {
						sxkxx.setXuenian(DBGridYxkcTableTrTds.get(0).asText());
						sxkxx.setXueqi(DBGridYxkcTableTrTds.get(1).asText());
						sxkxx.setKechengmingcheng(DBGridYxkcTableTrTds.get(2).asText());
						sxkxx.setShixishijian(DBGridYxkcTableTrTds.get(3).asText());
						sxkxx.setMokuaidaima(DBGridYxkcTableTrTds.get(4).asText());
						sxkxx.setXianxiumokuai(DBGridYxkcTableTrTds.get(5).asText());
						sxkxx.setShixibianhao(DBGridYxkcTableTrTds.get(6).asText());
						sxkxxList.add(sxkxx);
					}
				}
				map.put("sxkxxList", sxkxxList);
				
				List<WAPkxx> wapkxxList = new ArrayList<WAPkxx>();
				HtmlTable Datagrid2Table = (HtmlTable) page.getElementById("Datagrid2");
				DomNodeList<HtmlElement> Datagrid2TableTrs = Datagrid2Table.getElementsByTagName("tr");
				for (int k = 1; k < Datagrid2TableTrs.size(); k++) {
					WAPkxx wapkxx = new WAPkxx();
					HtmlElement Datagrid2TableTr = Datagrid2TableTrs.get(k);
					DomNodeList<HtmlElement> Datagrid2TableTrTds = Datagrid2TableTr.getElementsByTagName("td");
					if(Datagrid2TableTrTds.size()!= 0) {
						wapkxx.setXuenian(Datagrid2TableTrTds.get(0).asText());
						wapkxx.setXueqi(Datagrid2TableTrTds.get(1).asText());
						wapkxx.setKechengmingcheng(Datagrid2TableTrTds.get(2).asText());
						wapkxx.setJiaoshixingming(Datagrid2TableTrTds.get(3).asText());
						wapkxx.setXuefen(Datagrid2TableTrTds.get(4).asText());
						wapkxxList.add(wapkxx);
					}
				}
				map.put("wapkxxList", wapkxxList);
				long time4 = System.currentTimeMillis();
				long totleTime = time4 - time1;
				long jiazaiTime = time3 - time2;
				long chuliTime = time2 - time1 + (time4 - time3);
				map.put("time","总用时为："+totleTime/1000+"s,网站加载用时："+jiazaiTime/1000+"s,无障碍处理用时："+chuliTime/1000+"s");
				map.put("notice", "true");
				return map;
			}
			synchronized (page) {
				try {
					page.wait(500);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				log.info("加载变更文件......");
			}
		}
		map.put("notice", "false");
		return map;
	}

	/**
	 * 默认加载成绩查询
	 */
	@Override
	public Map<String, Object> loadcjcx(String num) {
		Map<String, Object> map = new HashMap<String ,Object>();
		long time1 = System.currentTimeMillis();
		String URLxscjcx = Csair.BJLHxscjcxPage+"?xh="+num;
		xscjcxPage = webClient.getCsairHtmlPage(URLxscjcx, "xscjcxPage", false);
		HtmlPage page = xscjcxPage.getHtmlPage();
		for (int i = 0; i < timeoutmax; i++) {
			DomNodeList<HtmlElement> as = page.getBody().getElementsByTagName("a");
			if(as.size()!= 0) {
				long time2 = System.currentTimeMillis();
				HtmlAnchor a = (HtmlAnchor) as.get(0);
				if(a.asText().contains("here")) {
					clickHandler(a);
					long time3 = System.currentTimeMillis();
					for (int j = 0; j < timeoutmax; j++) {
						HtmlTable Datagrid3 = (HtmlTable) page.getElementById("Datagrid3");
						if(Datagrid3!= null) {
							long time4 = System.currentTimeMillis();
							map.put("num", num);
							HtmlSpan lbl_xmSpan = (HtmlSpan) page.getElementById("lbl_xm");
							map.put("name", lbl_xmSpan.asText());
							HtmlSpan lbl_xySpan = (HtmlSpan) page.getElementById("lbl_xy");
							map.put("colleage", lbl_xySpan.asText());
							HtmlSpan lbl_zymcSpan = (HtmlSpan) page.getElementById("lbl_zymc");
							map.put("major", lbl_zymcSpan.asText());
							HtmlSpan lbl_zyfxSpan = (HtmlSpan) page.getElementById("lbl_zyfx");
							map.put("zyfx", lbl_zyfxSpan.asText());
							HtmlSpan lbl_xzbSpan = (HtmlSpan) page.getElementById("lbl_xzb");
							map.put("xzb", lbl_xzbSpan.asText());
							HtmlSpan lbl_grid3Span = (HtmlSpan) page.getElementById("lbl_grid3");
							String chaxunTitle = lbl_grid3Span.getElementsByTagName("b").get(0).asText();
							map.put("chaxunTitle", chaxunTitle);
							
							List<Wtgorkczgcj> wtgorkczgcjList = new ArrayList<Wtgorkczgcj>();
							DomNodeList<HtmlElement> Datagrid3Trs = Datagrid3.getElementsByTagName("tr");
							for (int k = 1; k < Datagrid3Trs.size(); k++) {
								Wtgorkczgcj wtgorkczgcj = new Wtgorkczgcj();
								HtmlElement Datagrid3Tr = Datagrid3Trs.get(k);
								DomNodeList<HtmlElement> Datagrid3TrTds = Datagrid3Tr.getElementsByTagName("td");
								if(Datagrid3TrTds.size()!= 0 ) {
									wtgorkczgcj.setKechengdaima(Datagrid3TrTds.get(0).asText());
									wtgorkczgcj.setKechengmingcheng(Datagrid3TrTds.get(1).asText());
									wtgorkczgcj.setKechengxingzhi(Datagrid3TrTds.get(2).asText());
									wtgorkczgcj.setXuefen(Datagrid3TrTds.get(3).asText());
									wtgorkczgcj.setZuigaochengjizhi(Datagrid3TrTds.get(4).asText());
									wtgorkczgcj.setKechengguishu(Datagrid3TrTds.get(5).asText());
									wtgorkczgcjList.add(wtgorkczgcj);
								}
							}
							map.put("wtgorkczgcjList", wtgorkczgcjList);
							long time5 = System.currentTimeMillis();
							long totleTime = time5 - time1;
							long jiazaiTime = time2 - time1 + (time4 - time3);
							long chuliTime = time3 - time2 + (time5 - time4);
							map.put("time","总用时为："+totleTime/1000+"s,网站加载用时："+jiazaiTime/1000+"s,无障碍处理用时："+chuliTime/1000+"s");
							map.put("notice", "true");
							return map;
							
						}
						synchronized (page) {
							try {
								page.wait(800);
							} catch (InterruptedException e) {
								// TODO Auto-generated catch block
								e.printStackTrace();
							}
							log.info("加载成绩查询页........");
						}
					}
					
				}
			}
			
			synchronized (page) {
				try {
					page.wait(500);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				log.info("加载跳转页........");
			}	
		}
		map.put("notice", "false");
		return map;
	}

	/**
	 * 最高成绩查询
	 */
	@Override
	public Map<String, Object> loadzgcjcx(String num, String ddlXN, String ddlXQ, String ddl_kcxz) {
		scl.BJLHLoginSuccess = null;
		Map<String, Object> map = new HashMap<String ,Object>();
		long time1 = System.currentTimeMillis();
		HtmlPage page = xscjcxPage.getHtmlPage();
		HtmlSelect ddlXNSelect = (HtmlSelect) page.getElementById("ddlXN");
		HtmlOption ddlXNOption = ddlXNSelect.getOptionByValue(ddlXN);
		ddlXNOption.setSelected(true);
		
		HtmlSelect ddlXQSelect = (HtmlSelect) page.getElementById("ddlXQ");
		HtmlOption ddlXQOption = ddlXQSelect.getOptionByValue(ddlXN);
		ddlXQOption.setSelected(true);
		
		HtmlSelect ddl_kcxzSelect = (HtmlSelect) page.getElementById("ddl_kcxz");
		HtmlOption ddl_kcxzOption = ddl_kcxzSelect.getOptionByValue(ddlXN);
		ddl_kcxzOption.setSelected(true);
		
		HtmlInput btn_zgInput = (HtmlInput) page.getElementById("btn_zg");
		clickHandler(btn_zgInput);
		long time2 = System.currentTimeMillis();
		for (int i = 0; i < timeoutmax; i++) {
			if(scl.BJLHLoginSuccess != null) {
				long time3 = System.currentTimeMillis();
				map.put("num", num);
				HtmlSpan lbl_xmSpan = (HtmlSpan) page.getElementById("lbl_xm");
				map.put("name", lbl_xmSpan.asText());
				HtmlSpan lbl_xySpan = (HtmlSpan) page.getElementById("lbl_xy");
				map.put("colleage", lbl_xySpan.asText());
				HtmlSpan lbl_zymcSpan = (HtmlSpan) page.getElementById("lbl_zymc");
				map.put("major", lbl_zymcSpan.asText());
				HtmlSpan lbl_zyfxSpan = (HtmlSpan) page.getElementById("lbl_zyfx");
				map.put("zyfx", lbl_zyfxSpan.asText());
				HtmlSpan lbl_xzbSpan = (HtmlSpan) page.getElementById("lbl_xzb");
				map.put("xzb", lbl_xzbSpan.asText());
				HtmlSpan lbl_grid3Span = (HtmlSpan) page.getElementById("lbl_grid3");
				String chaxunTitle = lbl_grid3Span.getElementsByTagName("b").get(0).asText();
				map.put("chaxunTitle", chaxunTitle);
				
				List<Wtgorkczgcj> wtgorkczgcjList = new ArrayList<Wtgorkczgcj>();
				HtmlTable Datagrid3 = (HtmlTable) page.getElementById("Datagrid3");
				DomNodeList<HtmlElement> Datagrid3Trs = Datagrid3.getElementsByTagName("tr");
				for (int k = 1; k < Datagrid3Trs.size(); k++) {
					Wtgorkczgcj wtgorkczgcj = new Wtgorkczgcj();
					HtmlElement Datagrid3Tr = Datagrid3Trs.get(k);
					DomNodeList<HtmlElement> Datagrid3TrTds = Datagrid3Tr.getElementsByTagName("td");
					if(Datagrid3TrTds.size()!= 0 ) {
						wtgorkczgcj.setKechengdaima(Datagrid3TrTds.get(0).asText());
						wtgorkczgcj.setKechengmingcheng(Datagrid3TrTds.get(1).asText());
						wtgorkczgcj.setKechengxingzhi(Datagrid3TrTds.get(2).asText());
						wtgorkczgcj.setXuefen(Datagrid3TrTds.get(3).asText());
						wtgorkczgcj.setZuigaochengjizhi(Datagrid3TrTds.get(4).asText());
						wtgorkczgcj.setKechengguishu(Datagrid3TrTds.get(5).asText());
						wtgorkczgcjList.add(wtgorkczgcj);
					}
				}
				map.put("wtgorkczgcjList", wtgorkczgcjList);
				long time4 = System.currentTimeMillis();
				long totleTime = time4 - time1;
				long jiazaiTime = time3 - time2;
				long chuliTime = time2 - time1 + (time4 - time3);
				map.put("time","总用时为："+totleTime/1000+"s,网站加载用时："+jiazaiTime/1000+"s,无障碍处理用时："+chuliTime/1000+"s");
				map.put("notice", "true");
				return map;
			}
			synchronized (page) {
				try {
					page.wait(800);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				log.info("加载文件.......");
			}
		}
		map.put("notice", "false");
		return map;
	}

	/**
	 * 未通过成绩查询
	 */
	@Override
	public Map<String, Object> loadwtgcjcx(String num, String ddlXN, String ddlXQ, String ddl_kcxz) {
		scl.BJLHLoginSuccess = null;
		Map<String, Object> map = new HashMap<String ,Object>();
		long time1 = System.currentTimeMillis();
		HtmlPage page = xscjcxPage.getHtmlPage();
		HtmlSelect ddlXNSelect = (HtmlSelect) page.getElementById("ddlXN");
		HtmlOption ddlXNOption = ddlXNSelect.getOptionByValue(ddlXN);
		ddlXNOption.setSelected(true);
		
		HtmlSelect ddlXQSelect = (HtmlSelect) page.getElementById("ddlXQ");
		HtmlOption ddlXQOption = ddlXQSelect.getOptionByValue(ddlXN);
		ddlXQOption.setSelected(true);
		
		HtmlSelect ddl_kcxzSelect = (HtmlSelect) page.getElementById("ddl_kcxz");
		HtmlOption ddl_kcxzOption = ddl_kcxzSelect.getOptionByValue(ddlXN);
		ddl_kcxzOption.setSelected(true);
		
		HtmlInput Button2Input = (HtmlInput) page.getElementById("Button2");
		clickHandler(Button2Input);
		long time2 = System.currentTimeMillis();
		HtmlTable Datagrid3 = (HtmlTable) page.getElementById("Datagrid3");
		for (int i = 0; i < timeoutmax; i++) {
			if(scl.BJLHLoginSuccess != null && Datagrid3 != null) {
				long time3 = System.currentTimeMillis();
				map.put("num", num);
				HtmlSpan lbl_xmSpan = (HtmlSpan) page.getElementById("lbl_xm");
				map.put("name", lbl_xmSpan.asText());
				HtmlSpan lbl_xySpan = (HtmlSpan) page.getElementById("lbl_xy");
				map.put("colleage", lbl_xySpan.asText());
				HtmlSpan lbl_zymcSpan = (HtmlSpan) page.getElementById("lbl_zymc");
				map.put("major", lbl_zymcSpan.asText());
				HtmlSpan lbl_zyfxSpan = (HtmlSpan) page.getElementById("lbl_zyfx");
				map.put("zyfx", lbl_zyfxSpan.asText());
				HtmlSpan lbl_xzbSpan = (HtmlSpan) page.getElementById("lbl_xzb");
				map.put("xzb", lbl_xzbSpan.asText());
				HtmlSpan lbl_grid3Span = (HtmlSpan) page.getElementById("lbl_grid3");
				String chaxunTitle = lbl_grid3Span.getElementsByTagName("b").get(0).asText();
				map.put("chaxunTitle", chaxunTitle);
				
				List<Wtgorkczgcj> wtgorkczgcjList = new ArrayList<Wtgorkczgcj>();
				
				DomNodeList<HtmlElement> Datagrid3Trs = Datagrid3.getElementsByTagName("tr");
				for (int k = 1; k < Datagrid3Trs.size(); k++) {
					Wtgorkczgcj wtgorkczgcj = new Wtgorkczgcj();
					HtmlElement Datagrid3Tr = Datagrid3Trs.get(k);
					DomNodeList<HtmlElement> Datagrid3TrTds = Datagrid3Tr.getElementsByTagName("td");
					if(Datagrid3TrTds.size()!= 0 ) {
						wtgorkczgcj.setKechengdaima(Datagrid3TrTds.get(0).asText());
						wtgorkczgcj.setKechengmingcheng(Datagrid3TrTds.get(1).asText());
						wtgorkczgcj.setKechengxingzhi(Datagrid3TrTds.get(2).asText());
						wtgorkczgcj.setXuefen(Datagrid3TrTds.get(3).asText());
						wtgorkczgcj.setZuigaochengjizhi(Datagrid3TrTds.get(4).asText());
						wtgorkczgcj.setKechengguishu(Datagrid3TrTds.get(5).asText());
						wtgorkczgcjList.add(wtgorkczgcj);
					}
				}
				map.put("wtgorkczgcjList", wtgorkczgcjList);
				long time4 = System.currentTimeMillis();
				long totleTime = time4 - time1;
				long jiazaiTime = time3 - time2;
				long chuliTime = time2 - time1 + (time4 - time3);
				map.put("time","总用时为："+totleTime/1000+"s,网站加载用时："+jiazaiTime/1000+"s,无障碍处理用时："+chuliTime/1000+"s");
				map.put("notice", "true");
				return map;
			}
			synchronized (page) {
				try {
					page.wait(800);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				log.info("加载文件.......");
			}
		}
		map.put("notice", "false");
		return map;
	}

	/**
	 * 学期成绩查询
	 */
	@Override
	public Map<String, Object> loadxqcjcx(String num, String ddlXN, String ddlXQ, String ddl_kcxz) {
		scl.BJLHLoginSuccess = null;
		long time1 = System.currentTimeMillis();
		Map<String, Object> map = new HashMap<String ,Object>();
		HtmlPage page = xscjcxPage.getHtmlPage();
		HtmlSelect ddlXNSelect = (HtmlSelect) page.getElementById("ddlXN");
		HtmlOption ddlXNOption = ddlXNSelect.getOptionByValue(ddlXN);
		ddlXNOption.setSelected(true);
		
		HtmlSelect ddlXQSelect = (HtmlSelect) page.getElementById("ddlXQ");
		HtmlOption ddlXQOption = ddlXQSelect.getOptionByValue(ddlXN);
		ddlXQOption.setSelected(true);
		
		HtmlSelect ddl_kcxzSelect = (HtmlSelect) page.getElementById("ddl_kcxz");
		HtmlOption ddl_kcxzOption = ddl_kcxzSelect.getOptionByValue(ddlXN);
		ddl_kcxzOption.setSelected(true);
		
		HtmlInput btn_xqInput = (HtmlInput) page.getElementById("btn_xq");
		clickHandler(btn_xqInput);
		long time2 = System.currentTimeMillis();
		HtmlTable Datagrid1 = (HtmlTable) page.getElementById("Datagrid1");
		for (int i = 0; i < timeoutmax; i++) {
			if(scl.BJLHLoginSuccess != null && Datagrid1 != null) {
				long time3 = System.currentTimeMillis();
				map.put("num", num);
				HtmlSpan lbl_xmSpan = (HtmlSpan) page.getElementById("lbl_xm");
				map.put("name", lbl_xmSpan.asText());
				HtmlSpan lbl_xySpan = (HtmlSpan) page.getElementById("lbl_xy");
				map.put("colleage", lbl_xySpan.asText());
				HtmlSpan lbl_zymcSpan = (HtmlSpan) page.getElementById("lbl_zymc");
				map.put("major", lbl_zymcSpan.asText());
				HtmlSpan lbl_zyfxSpan = (HtmlSpan) page.getElementById("lbl_zyfx");
				map.put("zyfx", lbl_zyfxSpan.asText());
				HtmlSpan lbl_xzbSpan = (HtmlSpan) page.getElementById("lbl_xzb");
				map.put("xzb", lbl_xzbSpan.asText());
				HtmlSpan lbl_btSpan = (HtmlSpan) page.getElementById("lbl_bt");
				String chaxunTitle = lbl_btSpan.getElementsByTagName("b").get(0).asText();
				map.put("chaxunTitle", chaxunTitle);
				
				List<Xqorxnorlncjcx> xqorxnorlncjcxList = new ArrayList<Xqorxnorlncjcx>();
				DomNodeList<HtmlElement> Datagrid1Trs = Datagrid1.getElementsByTagName("tr");
				for (int k = 1; k < Datagrid1Trs.size(); k++) {
					Xqorxnorlncjcx xqorxnorlncjcx = new Xqorxnorlncjcx();
					HtmlElement Datagrid1Tr = Datagrid1Trs.get(k);
					DomNodeList<HtmlElement> Datagrid1TrTds = Datagrid1Tr.getElementsByTagName("td");
					if(Datagrid1TrTds.size() != 0) {
						xqorxnorlncjcx.setXuenian(Datagrid1TrTds.get(0).asText());
						xqorxnorlncjcx.setXueqi(Datagrid1TrTds.get(1).asText());
						xqorxnorlncjcx.setKechengdaima(Datagrid1TrTds.get(2).asText());
						xqorxnorlncjcx.setKechengmingcheng(Datagrid1TrTds.get(3).asText());
						xqorxnorlncjcx.setKechengxingzhi(Datagrid1TrTds.get(4).asText());
						xqorxnorlncjcx.setKechengguishu(Datagrid1TrTds.get(5).asText());
						xqorxnorlncjcx.setXuefen(Datagrid1TrTds.get(6).asText());
						xqorxnorlncjcx.setJidian(Datagrid1TrTds.get(7).asText());
						xqorxnorlncjcx.setChengji(Datagrid1TrTds.get(8).asText());
						xqorxnorlncjcx.setFuxiubiaoji(Datagrid1TrTds.get(9).asText());
						xqorxnorlncjcx.setBukaochengji(Datagrid1TrTds.get(10).asText());
						xqorxnorlncjcx.setChongxiuchengji(Datagrid1TrTds.get(11).asText());
						xqorxnorlncjcx.setKaikexueyuan(Datagrid1TrTds.get(12).asText());
						xqorxnorlncjcx.setBeizhu(Datagrid1TrTds.get(13).asText());
						xqorxnorlncjcx.setChongxiubiaoji(Datagrid1TrTds.get(14).asText());
						xqorxnorlncjcxList.add(xqorxnorlncjcx);
					}
				}
				map.put("xqorxnorlncjcxList",xqorxnorlncjcxList );
				long time4 = System.currentTimeMillis();
				long totleTime = time4 - time1;
				long jiazaiTime = time3 - time2;
				long chuliTime = time2 - time1 + (time4 - time3);
				map.put("time","总用时为："+totleTime/1000+"s,网站加载用时："+jiazaiTime/1000+"s,无障碍处理用时："+chuliTime/1000+"s");
				map.put("notice", "true");
				return map;
			}
			synchronized (page) {
				try {
					page.wait(800);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				log.info("加载文件.......");
			}
		}
		map.put("notice", "false");
		return map;
	}

	/**
	 * 学年成绩查询
	 */
	@Override
	public Map<String, Object> loadxncjcx(String num, String ddlXN, String ddlXQ, String ddl_kcxz) {
		scl.BJLHLoginSuccess = null;
		Map<String, Object> map = new HashMap<String ,Object>();
		long time1 = System.currentTimeMillis();
		HtmlPage page = xscjcxPage.getHtmlPage();
		HtmlSelect ddlXNSelect = (HtmlSelect) page.getElementById("ddlXN");
		HtmlOption ddlXNOption = ddlXNSelect.getOptionByValue(ddlXN);
		ddlXNOption.setSelected(true);
		
		HtmlSelect ddlXQSelect = (HtmlSelect) page.getElementById("ddlXQ");
		HtmlOption ddlXQOption = ddlXQSelect.getOptionByValue(ddlXN);
		ddlXQOption.setSelected(true);
		
		HtmlSelect ddl_kcxzSelect = (HtmlSelect) page.getElementById("ddl_kcxz");
		HtmlOption ddl_kcxzOption = ddl_kcxzSelect.getOptionByValue(ddlXN);
		ddl_kcxzOption.setSelected(true);
		
		HtmlInput btn_xqInput = (HtmlInput) page.getElementById("btn_xn");
		clickHandler(btn_xqInput);
		long time2 = System.currentTimeMillis();
		HtmlTable Datagrid1 = (HtmlTable) page.getElementById("Datagrid1");
		for (int i = 0; i < timeoutmax; i++) {
			if(scl.BJLHLoginSuccess != null && Datagrid1 != null) {
				long time3 = System.currentTimeMillis();
				map.put("num", num);
				HtmlSpan lbl_xmSpan = (HtmlSpan) page.getElementById("lbl_xm");
				map.put("name", lbl_xmSpan.asText());
				HtmlSpan lbl_xySpan = (HtmlSpan) page.getElementById("lbl_xy");
				map.put("colleage", lbl_xySpan.asText());
				HtmlSpan lbl_zymcSpan = (HtmlSpan) page.getElementById("lbl_zymc");
				map.put("major", lbl_zymcSpan.asText());
				HtmlSpan lbl_zyfxSpan = (HtmlSpan) page.getElementById("lbl_zyfx");
				map.put("zyfx", lbl_zyfxSpan.asText());
				HtmlSpan lbl_xzbSpan = (HtmlSpan) page.getElementById("lbl_xzb");
				map.put("xzb", lbl_xzbSpan.asText());
				HtmlSpan lbl_btSpan = (HtmlSpan) page.getElementById("lbl_bt");
				String chaxunTitle = lbl_btSpan.getElementsByTagName("b").get(0).asText();
				map.put("chaxunTitle", chaxunTitle);
				
				List<Xqorxnorlncjcx> xqorxnorlncjcxList = new ArrayList<Xqorxnorlncjcx>();
				DomNodeList<HtmlElement> Datagrid1Trs = Datagrid1.getElementsByTagName("tr");
				for (int k = 1; k < Datagrid1Trs.size(); k++) {
					Xqorxnorlncjcx xqorxnorlncjcx = new Xqorxnorlncjcx();
					HtmlElement Datagrid1Tr = Datagrid1Trs.get(k);
					DomNodeList<HtmlElement> Datagrid1TrTds = Datagrid1Tr.getElementsByTagName("td");
					if(Datagrid1TrTds.size() != 0) {
						xqorxnorlncjcx.setXuenian(Datagrid1TrTds.get(0).asText());
						xqorxnorlncjcx.setXueqi(Datagrid1TrTds.get(1).asText());
						xqorxnorlncjcx.setKechengdaima(Datagrid1TrTds.get(2).asText());
						xqorxnorlncjcx.setKechengmingcheng(Datagrid1TrTds.get(3).asText());
						xqorxnorlncjcx.setKechengxingzhi(Datagrid1TrTds.get(4).asText());
						xqorxnorlncjcx.setKechengguishu(Datagrid1TrTds.get(5).asText());
						xqorxnorlncjcx.setXuefen(Datagrid1TrTds.get(6).asText());
						xqorxnorlncjcx.setJidian(Datagrid1TrTds.get(7).asText());
						xqorxnorlncjcx.setChengji(Datagrid1TrTds.get(8).asText());
						xqorxnorlncjcx.setFuxiubiaoji(Datagrid1TrTds.get(9).asText());
						xqorxnorlncjcx.setBukaochengji(Datagrid1TrTds.get(10).asText());
						xqorxnorlncjcx.setChongxiuchengji(Datagrid1TrTds.get(11).asText());
						xqorxnorlncjcx.setKaikexueyuan(Datagrid1TrTds.get(12).asText());
						xqorxnorlncjcx.setBeizhu(Datagrid1TrTds.get(13).asText());
						xqorxnorlncjcx.setChongxiubiaoji(Datagrid1TrTds.get(14).asText());
						xqorxnorlncjcxList.add(xqorxnorlncjcx);
					}
				}
				map.put("xqorxnorlncjcxList",xqorxnorlncjcxList );
				long time4 = System.currentTimeMillis();
				long totleTime = time4 - time1;
				long jiazaiTime = time3 - time2;
				long chuliTime = time2 - time1 + (time4 - time3);
				map.put("time","总用时为："+totleTime/1000+"s,网站加载用时："+jiazaiTime/1000+"s,无障碍处理用时："+chuliTime/1000+"s");
				map.put("notice", "true");
				return map;
			}
			synchronized (page) {
				try {
					page.wait(800);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				log.info("加载文件.......");
			}
		}
		map.put("notice", "false");
		return map;
	}

	/**
	 * 历年成绩查询
	 */
	@Override
	public Map<String, Object> loadlncjcx(String num, String ddlXN, String ddlXQ, String ddl_kcxz) {
		scl.BJLHLoginSuccess = null;
		Map<String, Object> map = new HashMap<String ,Object>();
		long time1 = System.currentTimeMillis();
		HtmlPage page = xscjcxPage.getHtmlPage();
		HtmlSelect ddlXNSelect = (HtmlSelect) page.getElementById("ddlXN");
		HtmlOption ddlXNOption = ddlXNSelect.getOptionByValue(ddlXN);
		ddlXNOption.setSelected(true);
		
		HtmlSelect ddlXQSelect = (HtmlSelect) page.getElementById("ddlXQ");
		HtmlOption ddlXQOption = ddlXQSelect.getOptionByValue(ddlXN);
		ddlXQOption.setSelected(true);
		
		HtmlSelect ddl_kcxzSelect = (HtmlSelect) page.getElementById("ddl_kcxz");
		HtmlOption ddl_kcxzOption = ddl_kcxzSelect.getOptionByValue(ddlXN);
		ddl_kcxzOption.setSelected(true);
		
		HtmlInput btn_xqInput = (HtmlInput) page.getElementById("btn_zcj");
		clickHandler(btn_xqInput);
		long time2 = System.currentTimeMillis();
		HtmlTable Datagrid1 = (HtmlTable) page.getElementById("Datagrid1");
		for (int i = 0; i < timeoutmax; i++) {
			if(scl.BJLHLoginSuccess != null && Datagrid1 != null) {
				long time3 = System.currentTimeMillis();
				map.put("num", num);
				HtmlSpan lbl_xmSpan = (HtmlSpan) page.getElementById("lbl_xm");
				map.put("name", lbl_xmSpan.asText());
				HtmlSpan lbl_xySpan = (HtmlSpan) page.getElementById("lbl_xy");
				map.put("colleage", lbl_xySpan.asText());
				HtmlSpan lbl_zymcSpan = (HtmlSpan) page.getElementById("lbl_zymc");
				map.put("major", lbl_zymcSpan.asText());
				HtmlSpan lbl_zyfxSpan = (HtmlSpan) page.getElementById("lbl_zyfx");
				map.put("zyfx", lbl_zyfxSpan.asText());
				HtmlSpan lbl_xzbSpan = (HtmlSpan) page.getElementById("lbl_xzb");
				map.put("xzb", lbl_xzbSpan.asText());
				HtmlSpan lbl_btSpan = (HtmlSpan) page.getElementById("lbl_bt");
				String chaxunTitle = lbl_btSpan.getElementsByTagName("b").get(0).asText();
				map.put("chaxunTitle", chaxunTitle);
				
				List<Xqorxnorlncjcx> xqorxnorlncjcxList = new ArrayList<Xqorxnorlncjcx>();
				DomNodeList<HtmlElement> Datagrid1Trs = Datagrid1.getElementsByTagName("tr");
				for (int k = 1; k < Datagrid1Trs.size(); k++) {
					Xqorxnorlncjcx xqorxnorlncjcx = new Xqorxnorlncjcx();
					HtmlElement Datagrid1Tr = Datagrid1Trs.get(k);
					DomNodeList<HtmlElement> Datagrid1TrTds = Datagrid1Tr.getElementsByTagName("td");
					if(Datagrid1TrTds.size() != 0) {
						xqorxnorlncjcx.setXuenian(Datagrid1TrTds.get(0).asText());
						xqorxnorlncjcx.setXueqi(Datagrid1TrTds.get(1).asText());
						xqorxnorlncjcx.setKechengdaima(Datagrid1TrTds.get(2).asText());
						xqorxnorlncjcx.setKechengmingcheng(Datagrid1TrTds.get(3).asText());
						xqorxnorlncjcx.setKechengxingzhi(Datagrid1TrTds.get(4).asText());
						xqorxnorlncjcx.setKechengguishu(Datagrid1TrTds.get(5).asText());
						xqorxnorlncjcx.setXuefen(Datagrid1TrTds.get(6).asText());
						xqorxnorlncjcx.setJidian(Datagrid1TrTds.get(7).asText());
						xqorxnorlncjcx.setChengji(Datagrid1TrTds.get(8).asText());
						xqorxnorlncjcx.setFuxiubiaoji(Datagrid1TrTds.get(9).asText());
						xqorxnorlncjcx.setBukaochengji(Datagrid1TrTds.get(10).asText());
						xqorxnorlncjcx.setChongxiuchengji(Datagrid1TrTds.get(11).asText());
						xqorxnorlncjcx.setKaikexueyuan(Datagrid1TrTds.get(12).asText());
						xqorxnorlncjcx.setBeizhu(Datagrid1TrTds.get(13).asText());
						xqorxnorlncjcx.setChongxiubiaoji(Datagrid1TrTds.get(14).asText());
						xqorxnorlncjcxList.add(xqorxnorlncjcx);
					}
				}
				map.put("xqorxnorlncjcxList",xqorxnorlncjcxList );
				long time4 = System.currentTimeMillis();
				long totleTime = time4 - time1;
				long jiazaiTime = time3 - time2;
				long chuliTime = time2 - time1 + (time4 - time3);
				map.put("time","总用时为："+totleTime/1000+"s,网站加载用时："+jiazaiTime/1000+"s,无障碍处理用时："+chuliTime/1000+"s");
				map.put("notice", "true");
				return map;
			}
			synchronized (page) {
				try {
					page.wait(800);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				log.info("加载文件.......");
			}
		}
		map.put("notice", "false");
		return map;
	}

	/**
	 * 成绩统计
	 */
	@Override
	public Map<String, Object> loadcjtj(String num, String ddlXN, String ddlXQ, String ddl_kcxz) {
		scl.BJLHLoginSuccess = null;
		Map<String, Object> map = new HashMap<String ,Object>();
		long time1 = System.currentTimeMillis();
		HtmlPage page = xscjcxPage.getHtmlPage();
		HtmlSelect ddlXNSelect = (HtmlSelect) page.getElementById("ddlXN");
		HtmlOption ddlXNOption = ddlXNSelect.getOptionByValue(ddlXN);
		ddlXNOption.setSelected(true);
		
		HtmlSelect ddlXQSelect = (HtmlSelect) page.getElementById("ddlXQ");
		HtmlOption ddlXQOption = ddlXQSelect.getOptionByValue(ddlXN);
		ddlXQOption.setSelected(true);
		
		HtmlSelect ddl_kcxzSelect = (HtmlSelect) page.getElementById("ddl_kcxz");
		HtmlOption ddl_kcxzOption = ddl_kcxzSelect.getOptionByValue(ddlXN);
		ddl_kcxzOption.setSelected(true);
		
		HtmlInput Button1Input = (HtmlInput) page.getElementById("Button1");
		clickHandler(Button1Input);
		long time2 = System.currentTimeMillis();
		HtmlDivision divNotPs = (HtmlDivision) page.getElementById("divNotPs");
		for (int i = 0; i < timeoutmax; i++) {
			if(scl.BJLHLoginSuccess != null && divNotPs != null) {
				long time3 = System.currentTimeMillis();
				map.put("num", num);
				HtmlSpan lbl_xmSpan = (HtmlSpan) page.getElementById("lbl_xm");
				map.put("name", lbl_xmSpan.asText());
				HtmlSpan lbl_xySpan = (HtmlSpan) page.getElementById("lbl_xy");
				map.put("colleage", lbl_xySpan.asText());
				HtmlSpan lbl_zymcSpan = (HtmlSpan) page.getElementById("lbl_zymc");
				map.put("major", lbl_zymcSpan.asText());
				HtmlSpan lbl_zyfxSpan = (HtmlSpan) page.getElementById("lbl_zyfx");
				map.put("zyfx", lbl_zyfxSpan.asText());
				HtmlSpan lbl_xzbSpan = (HtmlSpan) page.getElementById("lbl_xzb");
				map.put("xzb", lbl_xzbSpan.asText());
				HtmlSpan xftjSpan = (HtmlSpan) page.getElementById("xftj");
				String xftj = xftjSpan.getElementsByTagName("b").get(0).asText();
				map.put("xftj", xftj);
				
				List<Kechengxingzhilei> kechengxingzhileiList = new ArrayList<Kechengxingzhilei>();
				HtmlTable Datagrid2Table = (HtmlTable) page.getElementById("Datagrid2");
				DomNodeList<HtmlElement> Datagrid2TableTrs = Datagrid2Table.getElementsByTagName("tr");
				for (int k = 1; k < Datagrid2TableTrs.size(); k++) {
					Kechengxingzhilei kechengxingzhilei = new Kechengxingzhilei();
					HtmlElement Datagrid2TableTr = Datagrid2TableTrs.get(k);
					DomNodeList<HtmlElement> Datagrid2TableTrTds = Datagrid2TableTr.getElementsByTagName("td");
					if(Datagrid2TableTrTds.size()!= 0 ) {
						kechengxingzhilei.setKechengxingzhimingcheng(Datagrid2TableTrTds.get(0).asText());
						kechengxingzhilei.setXuefenyaoqiu(Datagrid2TableTrTds.get(1).asText());
						kechengxingzhilei.setHuodexuefen(Datagrid2TableTrTds.get(2).asText());
						kechengxingzhilei.setWeitongguoxuefen(Datagrid2TableTrTds.get(3).asText());
						kechengxingzhilei.setHaixuxuefen(Datagrid2TableTrTds.get(4).asText());
						kechengxingzhileiList.add(kechengxingzhilei);
					}
				}
				map.put("kechengxingzhileiList",kechengxingzhileiList );
				
				List<Kechengguishulei> kechengguishuleiList = new ArrayList<Kechengguishulei>();
				HtmlTable DataGrid6Table = (HtmlTable) page.getElementById("DataGrid6");
				DomNodeList<HtmlElement> DataGrid6TableTrs = DataGrid6Table.getElementsByTagName("tr");
				for (int k = 1; k < DataGrid6TableTrs.size(); k++) {
					Kechengguishulei kechengguishulei = new Kechengguishulei();
					HtmlElement DataGrid6TableTr = DataGrid6TableTrs.get(k);
					DomNodeList<HtmlElement> DataGrid6TableTrTds = DataGrid6TableTr.getElementsByTagName("td");
					if(DataGrid6TableTrTds.size()!= 0 ) {
						kechengguishulei.setKechengguishumingcheng(DataGrid6TableTrTds.get(0).asText());
						kechengguishulei.setXuefenyaoqiu(DataGrid6TableTrTds.get(1).asText());
						kechengguishulei.setHuodexuefen(DataGrid6TableTrTds.get(2).asText());
						kechengguishulei.setWeitongguoxuefen(DataGrid6TableTrTds.get(3).asText());
						kechengguishulei.setHaixuxuefen(DataGrid6TableTrTds.get(4).asText());
						kechengguishuleiList.add(kechengguishulei);
					}
				}
				map.put("kechengguishuleiList",kechengguishuleiList );
				
				List<Hejilei> hejileiList = new ArrayList<Hejilei>();
				HtmlTable DataGrid7Table = (HtmlTable) page.getElementById("DataGrid7");
				DomNodeList<HtmlElement> DataGrid7TableTrs = DataGrid7Table.getElementsByTagName("tr");
				for (int k = 1; k < DataGrid7TableTrs.size(); k++) {
					Hejilei hejilei = new Hejilei();
					HtmlElement DataGrid7TableTr = DataGrid7TableTrs.get(k);
					DomNodeList<HtmlElement> DataGrid7TableTrTds = DataGrid7TableTr.getElementsByTagName("td");
					if(DataGrid7TableTrTds.size()!= 0 ) {
						hejilei.setXuenian(DataGrid7TableTrTds.get(0).asText());
						hejilei.setXueqi(DataGrid7TableTrTds.get(1).asText());
						hejilei.setHuodexuefen(DataGrid7TableTrTds.get(2).asText());
						hejilei.setBjgkechengjixuefen(DataGrid7TableTrTds.get(3).asText());
						hejilei.setWeitongguoxuefen(DataGrid7TableTrTds.get(4).asText());
						hejilei.setShifoujinggao(DataGrid7TableTrTds.get(5).asText());
						hejileiList.add(hejilei);
					}
				}
				map.put("hejileiList",hejileiList );
				
				HtmlSpan zyzrsSpan = (HtmlSpan) page.getElementById("zyzrs");
				String zyzrs = zyzrsSpan.getElementsByTagName("b").get(0).asText();
				map.put("zyzrs", zyzrs);
				
				HtmlSpan pjxfjdSpan = (HtmlSpan) page.getElementById("pjxfjd");
				String pjxfjd = pjxfjdSpan.getElementsByTagName("b").get(0).asText();
				map.put("pjxfjd", pjxfjd);
				
				HtmlSpan xfjdzhSpan = (HtmlSpan) page.getElementById("xfjdzh");
				String xfjdzh = xfjdzhSpan.getElementsByTagName("b").get(0).asText();
				map.put("xfjdzh", xfjdzh);
				
				long time4 = System.currentTimeMillis();
				long totleTime = time4 - time1;
				long jiazaiTime = time3 - time2;
				long chuliTime = time2 - time1 + (time4 - time3);
				map.put("time","总用时为："+totleTime/1000+"s,网站加载用时："+jiazaiTime/1000+"s,无障碍处理用时："+chuliTime/1000+"s");
				map.put("notice", "true");
				return map;
			}
			synchronized (page) {
				try {
					page.wait(800);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				log.info("加载文件.......");
			}
		}
		map.put("notice", "false");
		return map;
	}
	
	
	/**
	 * 默认加载教师质量评价
	 */
	@Override
	public Map<String, Object> loadjszlpj(String num) {
		Map<String, Object> map = new HashMap<String ,Object>();
		long time1 = System.currentTimeMillis();
		String URLxsjxpj = Csair.BJLHxsjxpjPage+"&xh="+num;
		xsjxpjPage = webClient.getCsairHtmlPage(URLxsjxpj, "xsjxpjPage", false);
		HtmlPage page = xsjxpjPage.getHtmlPage();
		for (int i = 0; i < timeoutmax; i++) {
			DomNodeList<HtmlElement> as = page.getBody().getElementsByTagName("a");
			if(as.size()!= 0) {
				long time2 = System.currentTimeMillis();
				HtmlAnchor a = (HtmlAnchor) as.get(0);
				if(a.asText().contains("here")) {
					clickHandler(a);
					long time3 = System.currentTimeMillis();
					for (int j = 0; j < timeoutmax; j++) {
						HtmlTable DataGrid1 = (HtmlTable) page.getElementById("DataGrid1");
						if(DataGrid1!= null) {
							long time4 = System.currentTimeMillis();
							List<XnOption> kcOptionList = new ArrayList<XnOption>();
							HtmlSelect pjkcSelect = (HtmlSelect) page.getElementById("pjkc");
							DomNodeList<HtmlElement> kcOptions = pjkcSelect.getElementsByTagName("option");
							for (int k = 0; k < kcOptions.size(); k++) {
								XnOption xnOption = new XnOption();
								HtmlElement kcOption = kcOptions.get(k);
								String optionValue = kcOption.getAttribute("value");
								String optionText = kcOption.asText();
								xnOption.setOptionValue(optionValue);
								xnOption.setOptionText(optionText);
								kcOptionList.add(xnOption);
							}
							map.put("kcOptionList", kcOptionList);
							
							List<XnOption> kclxOptionList = new ArrayList<XnOption>();
							HtmlSelect dropDownList1Select = (HtmlSelect) page.getElementById("DropDownList1");
							DomNodeList<HtmlElement> kclxOptions = dropDownList1Select.getElementsByTagName("option");
							for (int k = 0; k < kclxOptions.size(); k++) {
								XnOption xnOption = new XnOption();
								HtmlElement kclxOption = kclxOptions.get(k);
								String optionValue = kclxOption.getAttribute("value");
								String optionText = kclxOption.asText();
								xnOption.setOptionValue(optionValue);
								xnOption.setOptionText(optionText);
								kclxOptionList.add(xnOption);
							}
							map.put("kclxOptionList", kclxOptionList);
							
							String DataGrid1Xml = DataGrid1.asXml();
							map.put("DataGrid1Xml", DataGrid1Xml);
							
							long time5 = System.currentTimeMillis();
							long totleTime = time5 - time1;
							long jiazaiTime = time2 - time1 + (time4 - time3);
							long chuliTime = time3 - time2 + (time5 - time4);
							map.put("time","总用时为："+totleTime/1000+"s,网站加载用时："+jiazaiTime/1000+"s,无障碍处理用时："+chuliTime/1000+"s");
							map.put("notice", "true");
							return map;
						}
						synchronized (page) {
							try {
								page.wait(800);
							} catch (InterruptedException e) {
								e.printStackTrace();
							}
							log.info("加载教师质量评价页........");
						}
					}
					
				}
			}
			
			synchronized (page) {
				try {
					page.wait(500);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				log.info("加载跳转页........");
			}	
		}
		map.put("notice", "false");
		return map;
	}

	/**
	 * 评价课程变更
	 */
	@Override
	public Map<String, Object> kcChange(String pjkc) {
		scl.BJLHxsjxpjReturnPage = null;
		Map<String, Object> map = new HashMap<String ,Object>();
		HtmlPage page = xsjxpjPage.getHtmlPage();
		HtmlSelect pjkcSelect = (HtmlSelect) page.getElementById("pjkc");
		HtmlOption kcOption = pjkcSelect.getOptionByValue(pjkc);
		kcOption.setSelected(true);
		for (int j = 0; j < timeoutmax; j++) {
			
			if(scl.BJLHxsjxpjReturnPage != null) {
				List<XnOption> kclxOptionList = new ArrayList<XnOption>();
				HtmlSelect dropDownList1Select = (HtmlSelect) page.getElementById("DropDownList1");
				DomNodeList<HtmlElement> kclxOptions = dropDownList1Select.getElementsByTagName("option");
				for (int k = 0; k < kclxOptions.size(); k++) {
					XnOption xnOption = new XnOption();
					HtmlElement kclxOption = kclxOptions.get(k);
					String optionValue = kclxOption.getAttribute("value");
					String optionText = kclxOption.asText();
					xnOption.setOptionValue(optionValue);
					xnOption.setOptionText(optionText);
					kclxOptionList.add(xnOption);
				}
				map.put("kclxOptionList", kclxOptionList);
				
				HtmlTable DataGrid1 = (HtmlTable) page.getElementById("DataGrid1");
				String DataGrid1Xml = DataGrid1.asXml();
				map.put("DataGrid1Xml", DataGrid1Xml);
				
				map.put("notice", "true");
				return map;
			}
			synchronized (page) {
				try {
					page.wait(800);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				log.info("课程变更，加载教师质量评价页........");
			}
		}
		map.put("notice", "false");
		return map;
	}

	/**
	 * 评价课程类型变更
	 */
	@Override
	public Map<String, Object> kclxChange(String kclx) {
		scl.BJLHxsjxpjReturnPage = null;
		Map<String, Object> map = new HashMap<String ,Object>();
		HtmlPage page = xsjxpjPage.getHtmlPage();
		HtmlSelect dropDownList1Select = (HtmlSelect) page.getElementById("DropDownList1");
		HtmlOption kclxOption = dropDownList1Select.getOptionByValue(kclx);
		kclxOption.setSelected(true);
		for (int j = 0; j < timeoutmax; j++) {
			
			if(scl.BJLHxsjxpjReturnPage != null) {
				HtmlTable DataGrid1 = (HtmlTable) page.getElementById("DataGrid1");
				String DataGrid1Xml = DataGrid1.asXml();
				map.put("DataGrid1Xml", DataGrid1Xml);
				
				map.put("notice", "true");
				return map;
			}
			synchronized (page) {
				try {
					page.wait(800);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				log.info("课程变更，加载教师质量评价页........");
			}
		}
		map.put("notice", "false");
		return map;
	}

	/**
	 * 具体教师评价onblur事件
	 */
	@Override
	public Map<String, Object> pingjia(String pingjiaValue, String pingjiaId) {
		Map<String, Object> map = new HashMap<String ,Object>();
		HtmlPage page = xsjxpjPage.getHtmlPage();
		HtmlSelect pingjiaSelect = (HtmlSelect) page.getElementById(pingjiaId);
		HtmlOption pingjiaOption = pingjiaSelect.getOptionByValue(pingjiaValue);
		pingjiaOption.setSelected(true);
		
		String pingjiaSelectValue = pingjiaSelect.getAttribute("value");
		log.info("pingjiaSelectValue====>"+pingjiaSelectValue);
		if(pingjiaSelectValue.equals(pingjiaValue)) {
			map.put("notice", "true");
		}else {
			map.put("notice", "false");
		}
		return map;
	}

	/**
	 * 点击保存按钮
	 */
	@Override
	public Map<String, Object> baocun(String pjxx) {
		scl.BJLHxsjxpjReturnPage = null;
		alertMessage = null;
		Map<String, Object> map = new HashMap<String ,Object>();
		HtmlPage page = xsjxpjPage.getHtmlPage();
		HtmlSelect pjkcSelect = (HtmlSelect) page.getElementById("pjkc");
		String pjkcSelectValue = pjkcSelect.getAttribute("value");
		log.info("pjkcSelectValue=====>"+pjkcSelectValue);
		HtmlTextArea pjxxTextarea = (HtmlTextArea) page.getElementById("pjxx");
		pjxxTextarea.setTextContent(pjxx);
		HtmlInput Button1 = (HtmlInput) page.getElementById("Button1");
		clickHandler(Button1);
		for (int i = 0; i < timeoutmax; i++) {
			if(scl.BJLHxsjxpjReturnPage != null) {
				if(alertMessage != null) {
					map.put("msg", alertMessage);
					map.put("notice", "false");
					return map;
				}
				String pjkcSelectValue2 = pjkcSelect.getAttribute("value");
				log.info("pjkcSelectValue2=====>"+pjkcSelectValue2);
				if(!pjkcSelectValue2.equals(pjkcSelectValue)) {
					map.put("notice", "true");
					map.put("pjkcSelectValue2", pjkcSelectValue2);
					return map;
				}
			}
			synchronized (page) {
				try {
					page.wait(200);
					log.info("等待保存信息反馈.......");
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		}
		return map;
	}

	/**
	 * 点击先评价，再提交按钮
	 */
	@Override
	public Map<String, Object> tijiao(String pjxx) {
		Map<String, Object> map = new HashMap<String ,Object>();
		HtmlPage page = xsjxpjPage.getHtmlPage();
		HtmlTextArea pjxxTextarea = (HtmlTextArea) page.getElementById("pjxx");
		pjxxTextarea.setTextContent(pjxx);
		HtmlInput Button1 = (HtmlInput) page.getElementById("Button2");
		clickHandler(Button1);
		map.put("msg", "点击先评价，再提交按钮！");
		return map;
	}

	/**
	 * 保存成功后页面变更
	 */
	@Override
	public Map<String, Object> baocunSuccessKcChange() {
		scl.BJLHxsjxpjReturnPage = null;
		Map<String, Object> map = new HashMap<String ,Object>();
		HtmlPage page = xsjxpjPage.getHtmlPage();
			
		List<XnOption> kclxOptionList = new ArrayList<XnOption>();
		HtmlSelect dropDownList1Select = (HtmlSelect) page.getElementById("DropDownList1");
		DomNodeList<HtmlElement> kclxOptions = dropDownList1Select.getElementsByTagName("option");
		for (int k = 0; k < kclxOptions.size(); k++) {
			XnOption xnOption = new XnOption();
			HtmlElement kclxOption = kclxOptions.get(k);
			String optionValue = kclxOption.getAttribute("value");
			String optionText = kclxOption.asText();
			xnOption.setOptionValue(optionValue);
			xnOption.setOptionText(optionText);
			kclxOptionList.add(xnOption);
		}
		map.put("kclxOptionList", kclxOptionList);
		
		HtmlTable DataGrid1 = (HtmlTable) page.getElementById("DataGrid1");
		String DataGrid1Xml = DataGrid1.asXml();
		map.put("DataGrid1Xml", DataGrid1Xml);
		
		return map;
	}

	

	

	

	
	
	

	

}
